﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using KingRoad.EPM.PersonnelLogEntity.Model;
using Unis.Framework.Core.Utility;
using KingRoad.EPM.PersonnelLogDAL.ScmDailycheckService;


namespace KingRoad.EPM.PersonnelLogBLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/1/12 13:59:50
    /// </summary> 
    public class ScmDailycheckUIRule
    {
        private readonly IScmDailycheckService _scmDailycheckService;
        
        
        public ScmDailycheckUIRule(){}
        
        /// <summary> 
        /// construct function... 
        /// </summary> 
        public ScmDailycheckUIRule(IScmDailycheckService  scmDailycheckService)
        {
           _scmDailycheckService=scmDailycheckService;
        }
        /// <summary>
        /// 根据条件获取日常检查列表
        /// </summary>
        /// <param name="sql">查询条件</param>
        /// <returns></returns>
        public List<ScmDailycheckInfo> GetDailycheckList(string sql)
        {
            return _scmDailycheckService.GetEntityList(sql);
        }
        /// <summary>
        /// 根据条件查询日常检查信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmDailycheckInfo> GetDailycheckListForPage(int numCurrentPage, int numPerPage,
                                                                        string orderByField, out int totalRecord, string sqlCondition)
        {
            var list = _scmDailycheckService.GetEntityListByContionRe(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }

        /// <summary>
        /// 根据主键获取日常检查信息
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        public ScmDailycheckInfo GetDailycheckInfo(Guid id)
        {
            return _scmDailycheckService.GetEntityById(id);
        }
        /// <summary>
        /// 添加日常检查信息
        /// </summary>
        /// <param name="info">日常检查信息</param>
        public void AddDailycheck(ScmDailycheckInfo info)
        {
            _scmDailycheckService.InsertEntity(info);
        }
        /// <summary>
        /// 修改日常检查信息
        /// </summary>
        /// <param name="info">日常检查信息</param>
        public void EditDailycheck(ScmDailycheckInfo info)
        {
            _scmDailycheckService.UpdateEntity(info);
        }
        /// <summary>
        /// 删除日常检查信息
        /// </summary>
        /// <param name="id"></param>
        public void DeleteDailycheck(string id)
        {
            _scmDailycheckService.DeleteEntityByStringID(id);
        }
    }
}
